import Mock from 'mockjs'

const data = Mock.mock({
  'items|30': [{
    id: '@id',
    order: '@id',
    'status|1': ['未完成', '已完成'],
    'statusa|1': ['正常', '空闲', '故障'],
    'statusb|1': ['等待', '正在运行', '已完成', '故障'],
    'statusc|1': ['未领取', '准备中', '已领取'],
    x: '1',
    h: '1',
    num: '5',
    equipmentProcess: 'name',
    starTime: '@datetime',
    endTime: '@datetime',
    userName: '@sentence(10, 20)',
    pageviews: '@integer(300, 5000)'
  }]
})

export default [
  {
    url: '/index/getEcharts',
    type: 'get',
    response: config => {
      return {
        code: 200, success: true, message: '操作成功！',
        data: {
          taskStatus: {
            passRate: 98,
            runTime: 8,
            peoples: 5,
            totalTime: 22,
            powerConsumption: 35
          },
          effectiveness: {
            xAxis: ['1-1', '1-2', '1-3', '1-4', '1-5', '1-6', '1-7'],
            value: [78, 56, 76, 111, 79, 60, 56]
          },
          orderTask: {
            taskList: ['任务1', '任务2', '任务3', '任务4', '任务5'],
            xAxis: ['1-1', '1-2', '1-3', '1-4', '1-5', '1-6', '1-7'],
            value: [
              {
                name: '任务1',
                type: 'line',
                stack: '总量',
                data: [12, 13, 10, 13, 90, 23, 21]
              },
              {
                name: '任务2',
                type: 'line',
                stack: '总量',
                data: [22, 12, 11, 24, 29, 33, 31]
              },
              {
                name: '任务3',
                type: 'line',
                stack: '总量',
                data: [-50, 23, 20, 15, 10, 30, 40]
              },
              {
                name: '任务4',
                type: 'line',
                stack: '总量',
                data: [32, 33, 31, 33, 30, 30, 30]
              },
              {
                name: '任务5',
                type: 'line',
                stack: '总量',
                data: [80, 92, 91, 94, 10, 30, 20]
              }
            ]
          },
          productQuality: {
            value: [
              { value: 80, name: '合格率' },
              { value: 20, name: '不合格率' }
            ]
          },
          alarm: {
            xAxis: ['1-1', '1-2', '1-3', '1-4', '1-5', '1-6', '1-7'],
            value: [820, 932, 901, 934, 1290, 1330, 1320]
          }
        }
      }
    }
  },
  {
    url: '/initDevice/edit',
    type: 'post',
    response: config => {
      return {
        code: 200, success: true, message: '操作成功！',
        data: {}
      }
    }
  },
  {
    url: '/initDevice/getDeviceName',
    type: 'get',
    response: config => {
      return {
        code: 200, success: true, message: '操作成功！',
        'data': {
          'list': [{ 'id': 1, 'name': '刨' }, { 'id': 2, 'name': '车' }]
        }
      }
    }
  },
  {
    url: '/initDevice/getDeviceCode',
    type: 'get',
    response: config => {
      return {
        code: 200, success: true, message: '操作成功！',
        data: {
          list: ['1231', '343']
        }
      }
    }
  }
]
